Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
is-iterable
Advanced tools
The is-iterable npm package is a utility that allows you to check if a given value is iterable. This can be useful in various scenarios where you need to ensure that a value can be iterated over, such as in loops or when using spread operators.
Check if a value is iterable
This feature allows you to check if a given value is iterable. The code sample demonstrates checking various types of values, including arrays, strings, numbers, and objects.
const isIterable = require('is-iterable');
console.log(isIterable([1, 2, 3])); // true
console.log(isIterable('hello')); // true
console.log(isIterable(123)); // false
console.log(isIterable({})); // false
The isarray package is a simple utility to check if a value is an array. While it is more specific than is-iterable, it can be useful if you only need to check for arrays. Unlike is-iterable, it does not check for other iterable types like strings.
The lodash.isarray package is part of the Lodash library and provides a method to check if a value is an array. It is similar to isarray but is part of the larger Lodash utility library, which offers a wide range of other utility functions. It does not check for other iterable types.
The core-js package is a polyfill that includes a wide range of ECMAScript features, including checks for iterable types. It is more comprehensive than is-iterable and includes many other polyfills for modern JavaScript features.
Checks if a given object is iterable.
$ npm install --save is-iterable
var isIterable = require('is-iterable');
isIterable([]); // true
isIterable({}); // false
MIT © Hemanth.HM
FAQs
Checks if a given object is iterable
We found that is-iterable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.